home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir42
/
doslbs.zip
/
DOSLIB09.CLA
< prev
Wrap
Text File
|
1994-02-12
|
7KB
|
149 lines
MEMBER('DOSLIB')
OMIT('╝')
╔════════════════════════════════════════════════════════════════════════════╗
║ Printer_Select - !Generated Procedure ║
╚════════════════════════════════════════════════════════════════════════════╝
Select_Printer Function(Dsp:PrinterName,Control:File)
Map
Module('C Standard Library')
DL:Access(*Cstring,Short),Short,Raw,Name('_access')
. .
New:PrinterFile CString(64),STATIC
New:PrinterName String(64)
CtlFile FILE,DRIVER('ASCII'),NAME(New:PrinterFile),PRE(Dos)
RECORD RECORD
Line STRING(255)
. .
Queue QUEUE,PRE(Que)
QueueLine STRING(80)
.
LoadingScreen SCREEN(4,32),CENTER,SHADOW,CUA,COLOR(1)
!dimensions=25,80,25,80
!style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
ROW(3,5) PAINT(1,25),COLOR(8)
ROW(1,1) STRING('█{8}'),COLOR(3)
COL(9) STRING('Loading Printers'),COLOR(2)
COL(25) STRING('█{8}'),COLOR(3)
ROW(4,1) STRING('█▄{30}█'),COLOR(3)
REPEAT(2)
ROW(2,1) STRING('█'),COLOR(3)
ROW(2,32) STRING('█'),COLOR(3)
.
REPEAT(1,25),INDEX(ShowIndx#)
ShowPercentage ROW(3,4) STRING(@s1),COLOR(8)
.
.
SCREEN SCREEN(22,41),PRE(SCR),CENTER,SHADOW,FADE,CUA,COLOR(1)
!dimensions=25,80,25,80
!style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
ROW(1,1) STRING('█{9}'),COLOR(113)
COL(10) STRING('Printer Selection Table'),COLOR(2)
COL(33) STRING('█{9}'),COLOR(113)
ROW(22,1) STRING('█▄{39}█'),COLOR(113)
REPEAT(20)
ROW(2,1) STRING('█'),COLOR(113)
ROW(2,41) STRING('█'),COLOR(113)
.
ROW(3,4) PROMPT('Current Printer :'),COLOR(4,5,40,6,7)
ROW(4,4) ENTRY(@s35),USE(New:PrinterName),OVR,SKIP,COLOR(8,9,38)
ROW(6,4) LIST(13,35),FROM(Que:QueueLine),HVSCROLL,USE(?Queue),IMM,COLOR(21,22,68)
ROW(20,5) BUTTON(' &Select '),SHADOW,KEY(EnterKey),USE(?Ok),COLOR(17,18,39,19,20)
COL(17) BUTTON(' &Edit '),SHADOW,USE(?Edit),COLOR(17,18,39,19,20)
COL(29) BUTTON(' &Cancel '),SHADOW,USE(?Cancel),COLOR(17,18,39,19,20)
.
CODE
If ~Omitted(2) then
New:PrinterFile = Control:File
Else
New:PrinterFile = Command('CLAPRINTER',0)
.
If Clip(New:PrinterFile) = '' then New:PrinterFile = 'PRINTER.CTL'.
OPEN(Screen) !Open the screen
DO FillQueue
DISPLAY
LOOP !Loop through the fields
CASE SELECTED() !Jump to field setup routine
END !End CASE
ACCEPT !Enable the mouse and keyboard
CASE FIELD() !Jump to field edit routine
OF ?Queue !If List box field
GET(Queue,CHOICE()) ! Get the selected printer name
Of ?Edit
ViewPrinters(New:PrinterFile)
Do FillQueue
OF ?Ok !If selecting a printer
New:PrinterName = Que:QueueLine ! Save the printer name
BREAK ! Break to exit
OF ?Cancel !If no printer name change
BREAK ! Break to exit
. . !End CASE
CLOSE(CtlFile) !Close the control file
FREE(Queue) !Free the QUEUE memory
Return(New:PrinterName)
FillQueue ROUTINE
Open(CtlFile)
If Error() then
Beep
New:PrinterFile = GetFileDetails('PRINTER.CTL','Printer Control File','*.CTL')
If Clip(New:PrinterFile) = '' then Return('').
Open(CtlFile)
If Error() then Return('').
.
If ~Omitted(1) then
New:PrinterName = Dsp:PrinterName
.
Open(LoadingScreen)
Loop ShowIndx# = 1 to 25
ShowPercentage = ' '
.
TotalBytes# = Bytes(CtlFile)
TotalCntr# = 0
TotalRead# = 0
LastCntr# = 1
Free(Queue)
SET(CtlFile) !Set to loop in file order
LOOP !While records found
NEXT(CtlFile) ! Get the next record
IF ERRORCODE() THEN BREAK. ! Break if no more records
TotalRead# += Bytes(CtlFile)
TotalCntr# = ((TotalRead# * 100) / TotalBytes#) / 4
If TotalCntr# > LastCntr# then
Loop ShowIndx# = LastCntr# to TotalCntr#
ShowPercentage = '▒'
.
LastCntr# = TotalCntr#
.
IF CLIP(UPPER(Dos:Line)) = 'PRINTERS' ! If on the 'PRINTERS' line
CYCLE ! Ignore it
. ! End IF
IF CLIP(UPPER(Dos:Line)) = 'PORTS' ! If on the 'PORTS' line
BREAK ! Quit reading from file
. ! End IF
IF CLIP(UPPER(Dos:Line)) = 'CONTROLS' ! If on the 'CONTROLS' line
BREAK ! Quit reading from file
. ! End IF
SpacePosition# = INSTRING(' ',Dos:Line,1,1)! Find the first space
Que:QueueLine = SUB(Dos:Line,SpacePosition#+1,LEN(CLIP(Dos:Line))-SpacePosition#)
ADD(Queue) ! Add the name to the QUEUE
. !End LOOP
Close(LoadingScreen)
Close(CtlFile)
Select(?Queue,1)
Exit